package com.gifts.ui.page.common;

import java.awt.BorderLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JPanel;

import com.gifts.service.FacebookService;
import com.gifts.service.entity.FacebookUser;
/**
 * 
 * MainPanel that has Home page
 * @author dmaung
 *
 */
public class JMainPanel extends JPanel{
	
	private JLabel nameLabel;
	private JButton homeButton;
	private JButton logoutButton;
	
	private FacebookService facebookService = FacebookService.getInstance();
	public JMainPanel() {
		
		
		JPanel leftPanel = new JPanel();
		JPanel rightPanel = new JPanel();
		
		BorderLayout borderLayout = new BorderLayout();
		setLayout(borderLayout);
		
		nameLabel = new JLabel();
		leftPanel.add(nameLabel);
		
		homeButton = new JButton("Home");
		homeButton.addActionListener(new ActionListener() {

			@Override
			public void actionPerformed(ActionEvent arg0) {
				//facebookService.logout();
				
			}
			
		});
		logoutButton = new JButton("Logout");
		rightPanel.add(homeButton);
//		rightPanel.add(logoutButton);
		
		FacebookUser me = facebookService.findMe();
		nameLabel.setText("Hello " + me.getName());
		add(leftPanel,BorderLayout.WEST);
		add(rightPanel,BorderLayout.EAST);
		
		
	}
	
	
	public JButton getHomeButton() {
		return homeButton;
	}
	
	public JLabel getNameLabel() {
		return nameLabel;
	}
	
	public JButton getLogoutButton() {
		return logoutButton;
	}

}
